package article_service

import (
	"demo/models"
	"errors"
)

type Article struct {
	ID int
	Title string
	Content string
}

func (a *Article)Get() (*models.Article,error) {
	isExit,err := models.ExistArticleById(a.ID)
	if !isExit || err != nil {
		return nil,errors.New("文章不存在")
	}
	article,err := models.GetArticleDetail(a.ID)
	if err != nil {
		return nil,errors.New("文章不存在")
	}
	return article,nil
}